home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / info / rtnews / rtnv2n7 < prev    next >
Encoding:
Text File  |  1994-10-16  |  34.3 KB  |  899 lines

  1.  
  2.  _ __                 ______                         _ __
  3. ' )  )                  /                           ' )  )
  4.  /--' __.  __  ,     --/ __  __.  _. o ____  _,      /  / _  , , , _
  5. /  \_(_/|_/ (_/_    (_/ / (_(_/|_(__<_/ / <_(_)_    /  (_</_(_(_/_/_)_
  6.              /                               /|
  7.             '                               |/
  8.  
  9.             "Light Makes Right"
  10.  
  11.             October 13, 1989
  12.                 Volume 2, Number 7
  13.  
  14. Compiled by Eric Haines, 3D/Eye Inc, 2359 Triphammer Rd, Ithaca, NY 14850
  15.     NOTE ADDRESS CHANGE: wrath.cs.cornell.edu!eye!erich
  16.     [distributed by Michael Cohen <m-cohen@cs.utah.edu>, but send
  17.     contributions and subscriptions requests to Eric Haines]
  18. All contents are US copyright (c) 1989 by the individual authors
  19. Archive locations: anonymous FTP at cs.uoregon.edu (128.223.4.1) and at
  20.            freedom.graphics.cornell.edu (128.84.247.85), /pub/RTNews
  21.  
  22. Contents:
  23.     Introduction
  24.     New People and Address Changes
  25.     Solid Surface Modeler Information, by Eric Haines
  26.     Minimum Bounding Sphere Program, by Marshall Levine
  27.     Parallelism & Modeler Info Request, by Brian Corrie
  28.     ======== USENET cullings follow ========
  29.     Ray Tracer Available, by Craig Kolb
  30.     Source from Roy Hall's Book, by Tim O'Connor
  31.     More on Texture Mapping by Spatial Position, by Paul Lalonde
  32.     Procedural Bump-mapping Query, by Prem Subrahmanyam
  33.     Ray Tracer Performance on Machines,
  34.     by Gavin A. Bell, Phil Dykstra, Steve Lamont
  35.     Projective Mapping Explanation, by Ken "Turk" Turkowski
  36.     Intersection Calculation Problem Request, Jari Toivanen
  37.     Mathematical Elements for Computer Graphics - Call for Errata,
  38.     by David Rogers
  39.     Raytracing on NCUBE Request, by Ping Kang Hsiung
  40.     Intersection Between a Line and a Polygon (UNDECIDABLE??),
  41.     by Dave Baraff, Tom Duff
  42.  
  43. -------------------------------------------------------------------------------
  44.  
  45. Introduction
  46.  
  47.     It's October, the time when the air turns chilly, the leaves turn red, and
  48. people's minds turn towards releasing a public domain version of their ray
  49. tracer.  Holy smokes there's a lot of them coming out lately!  This month
  50. Craig Kolb's ray tracer has become available, along with the first PD ray
  51. tracer from Australia, by David Hook.  Paul Lalonde mentions that his will be
  52. coming out soon, and will include spline surfaces.  Also, David Kirk and Jim
  53. Arvo have created a ray tracer which they used in their workshop in Australia,
  54. and which may be released to the general public soon.  Other code that has
  55. been made available is that printed in Roy Hall's _Illumination and Color in
  56. Computer Generated Imagery_ book.
  57.  
  58.     Next month I hope to collect various timing information from all sorts of
  59. ray tracers on all sorts of machines.  I hope to do a "trace-off" sometime
  60. soon, comparing MTV's, Craig's, DBW, QRT, ART, mine, and any others I can get
  61. up and running.  If anyone else has any timings or observations on performance 
  62. of ray tracers and various machines, please send them to me.
  63.  
  64. -------------------------------------------------------------------------------
  65.  
  66. New People and Address Changes
  67.  
  68.  
  69. David Hook
  70. dgh@munnari.OZ.AU
  71.  
  72. Dept. Of Engineering Computer Resources
  73. University Of Melbourne
  74. Parkville, Vic, 3052
  75. Australia
  76.  
  77. G'day.
  78.  
  79. Our major area of interest in ray tracing is CSG modeling and we have a
  80. locally developed ray tracer which is a step towards this, as a department we
  81. are also involved with the Faculty of Architecture at this University, so we
  82. are starting to look at special effects somewhat more seriously than before.
  83. This has also led to a greater interest in acceleration techniques.
  84.  
  85. Personally, I am currently doing a masters degree in the area of CSG and ways
  86. of introducing patches into the model.  The rendering technique being used is
  87. ray tracing.
  88.  
  89.  
  90. [And a further note from David Hook:]
  91.  
  92. The mailing list has been set up on munnari, so if you send it to
  93. rtnews@munnari.OZ.AU, it will (should) travel around Oz to the people who want
  94. it.  I am asking people who subscribe if they wish to be on the contact list,
  95. etc...
  96.  
  97. As a bit of additional info, I have written a ray-tracer which does CSG and
  98. renders algebraic surfaces, (ala Pat Hanrahan), although in this case it's
  99. built around Sturm Sequences and we occasionally use CSG to take
  100. cross-sections of the surfaces.  The interest in algebraic surfaces began
  101. because a friend of mine was struggling with a 6th order surface known as the
  102. Hunt Surface, getting a good feel for the cusps on it was turning out to be
  103. awful using polygonal subdivision.  In any case there is a public domain
  104. version of all this sitting in pub on munnari.OZ.AU (128.250.1.21) which can
  105. be got by anonymous ftp.  The file is vort.tar.Z.  Knowing a bit more about
  106. the whole business now, it's a bit of an embarrassment!  Still it may be of
  107. interest to someone and constructive criticism is always welcome.
  108.  
  109.  
  110. [From a README file in his ray tracing distribution:]
  111.  
  112. By the by, for people who are interested, there are an excellent series of
  113. papers on ray tracing and computer graphics in general published in the NATO
  114. ASI Series of books.  The volume in question is in Vol.  40, series F, and is
  115. titled "Theoretical Foundations of Computer Graphics and CAD".  It was
  116. published in 1988 Springer-Verlag.  Roman Kuchkuda's paper in it "An
  117. Introduction To Ray Tracing", would be the best introductory paper we have
  118. seen to date.  Apart from that it was the first paper we found that actually
  119. said what a superquadric was!
  120.  
  121. --------
  122.  
  123. NAME:   Hench, Stephen D.              SNAIL MAIL: 2621-C Stewart Drive
  124. E MAIL: hench@csclea.ncsu.edu                      Raleigh, NC  27603
  125.  
  126. BRIEF: Undergrad in Mathematics and Computer Science at NCSU.
  127.        Interested in ray tracing (would I want to subscribe 
  128.        if I wasn't?), radiosity, and rendering in general.
  129.  
  130. --------
  131.  
  132. Marshall Levine
  133. 136 1937 Hall  Wilson College
  134. Princeton University
  135. Princeton, NJ 08544
  136. (609) 734-6061
  137.  
  138. Home:
  139. Marshall Levine
  140. 5212 Louise Avenue
  141. Encino, California 91316
  142. (818) 995-6528
  143. (818) 906-7068
  144.  
  145. E-mail:
  146. (1)  mplevine@phoenix.princeton.edu  or:
  147. (2)  mplevine@gauguin.princeton.edu   or:
  148. (3)  mplevine@bogey.princeton.edu
  149.  
  150. My main interests are helicopters and computer graphics.  Within graphics, I
  151. am interested in animation and motion control.  While I think it is great to
  152. see a ray-traced magnifying glass sitting on top of a cicuit board, I would
  153. rather see the magnifying glass fly smoothly over a spinning board while the
  154. camera flies smoothly through the scene.  I am currently designing a flexible
  155. graphics language with a friend of mine, Chris Williams (Princeton U. '92).
  156. If anyone is interested, I can say more about that later.
  157.  
  158. --------
  159.  
  160. Cornell Program of Computer Graphics
  161.  
  162. A ray tracing mailing list has been set up by Tim O'Connor:
  163.  
  164.     ray-tracing-news@wisdom.graphics.cornell.edu
  165.  
  166.     Program of Computer Graphics
  167.     120 Rand Hall
  168.     Cornell University
  169.     Ithaca, NY 14853
  170.  
  171. People on this list who've already been intro'ed here include: Roy Hall,
  172. Mark Reichert, Ben Trumbore, and Tim O'Connor.
  173.  
  174. New people and brief bio sketches:
  175.  
  176. Wash Wawrzynek - paw@squid.graphics.cornell.edu
  177.  
  178. Current interest are user interfaces and visualization for computational
  179. mechanics.
  180.  
  181. --------
  182.  
  183. Len Wanger - lrw@freedom.graphics.cornell.edu
  184.  
  185. My sketch is on a piece of paper, but my interests are:  I am a graduate
  186. student in the department of computer graphics at Cornell University.  I am
  187. interested in modeling and visual perception.
  188.  
  189. --------
  190.  
  191. Filippo Tampieri - fxt@freedom.graphics.cornell.edu
  192.  
  193. Areas of interest:  parallel/distributed ray tracing, fast algorithms for ray
  194. tracing.
  195.  
  196. --------
  197.  
  198. Ricardo Pomeranz - rxp@venus.graphics.cornell.edu
  199.  
  200. Interests: constructive solid geometry and rendering
  201.  
  202. --------
  203.  
  204. Paul Wanuga - phw@neptune.graphics.cornell.edu
  205.  
  206. Masters student at Cornell's Computer Graphics Lab.  Interests - rendering
  207. realistic complex environments in realistic times.
  208.  
  209. --------
  210.  
  211. Kathy Kershaw - kershaw@hope.graphics.cornell.edu
  212.  
  213. I'm Kathy Kershaw.  I did the ray tracing thing once.  Maybe it'll have
  214. something to do w/ my master's thesis; maybe not.
  215.  
  216. --------
  217.  
  218. Colin Summers - colin@scarpa.graphics.cornell.edu
  219.  
  220. Just recently interested in computer graphics and heading into the abyss from
  221. the architecture side, I have a background in personal computers and spent a
  222. year out of the design studio to computer consult in Manhattan.  Glad to be
  223. back in the world of academia.  As soon as someone comes across with a
  224. Macintosh like text processor for xWindows, let me know.
  225.  
  226. --------
  227.  
  228. Ted Himlan - thh@squid.Graphics.Cornell.EDU
  229.  
  230. Color science, radiometric measurement, array camera.
  231. interest:  detailed measurements on an environment 
  232.      for comparison to simulation.
  233.  
  234. --------
  235.  
  236. Julie O'Brien Dorsey - job@hope.graphics.cornell.edu
  237.  
  238. Computer aided design applications, radiosity, lighting design
  239.  
  240. --------
  241.  
  242. Francois Sillion - fxs@bruno.graphics.cornell.edu
  243.  
  244. I am currently on a Post-Doc position at Cornell, after having completed my
  245. PhD at the 'Ecole Normale Superieure' in Paris, France, where my work included
  246. the development of a two-pass method for lighting calculations, combining ray
  247. tracing and radiosity.
  248.  
  249. My interests are illumination models (local and global), animation and
  250. interactivity.
  251.  
  252. -------------------------------------------------------------------------------
  253.  
  254. Solid Surface Modeler Information, by Eric Haines
  255.  
  256. The Solid Surface Modeler from NASA finally came out.  The disappointing news
  257. is that even though it's "a non-profit unit of the University of Georgia," the
  258. thing is priced at $1250 for a cartridge tape and documentation (which is $43
  259. separately).  The reason I mention it is this newsletter is that it was used
  260. for some rather elaborate databases that were both modeled and ray traced on
  261. the AT&T Pixel Machine.  Unfortunately, it's unclear whether the Pixel Machine
  262. driver program is included in the distribution.  The modeler itself sounds
  263. reasonable, source code comes on the tape, and there seems to be no
  264. restrictions on the use of the software.  It's a pity that it's pricey when
  265. compared to, say, FSF stuff, but I guess someone has to pay for those glossy
  266. advertisement folders.
  267.  
  268. >From their literature:  "SSM was written in standard C with Silicon Graphic's
  269. Iris Graphics Library calls and AT&T PicLib calls....  The program is
  270. available for the Silicon Graphics IRIS workstation running version 3.1 of
  271. IRIX, and a Sun Workstation with AT&T PXM964 running 4.2 BSD."
  272.  
  273. For more information contact:
  274. COSMIC
  275. The University of Georgia
  276. 382 East Broad Street
  277. Athens, GA  30602
  278. (404)-542-3265
  279.  
  280. -------------------------------------------------------------------------------
  281.  
  282. Minimum Bounding Sphere Program, by Marshall Levine
  283.  
  284. I think you will be interested in the following program.  It is a
  285. minimum-bounding-sphere program.  As the explained in the header comments, the
  286. main algorithm seems to solve the problem in linear time.  Please let me know
  287. what you think.
  288.  
  289. { clusters.p
  290.  
  291. Written by Marshall Levine  (Princeton University '92)
  292. e-mail:  mplevine@phoenix.princeton.edu
  293. Algorithm designed by Marshall Levine and Chris Williams (Princeton U. '92)
  294.  
  295. This program searches through a 3-dimensional space of randomly distributed
  296. points for a cluster of 10 stars within the smallest radius possible.
  297.  
  298. I first implemented a "pri" list.  This is a linked list of real numbers
  299. (representing distances).  The list is kept in order.  However, when a number
  300. that would go farther into the list than the number of points per sphere
  301. (NUMINSPHERE) tries to go into the list, the insert procedure stops it.  This
  302. is done because the distance is useless.  For example, if NUMINSPHERE is 5 and
  303. a number would be inserted into the 7th slot in the list, it is not inserted.
  304. The minimum radius of a sphere with 5 points would be determined by the 5th
  305. element of the list (not including the header), so any number inserted after
  306. the 5th element is useless and is therefore not inserted.  If there are not
  307. NUMINSPHERE elements in the pri, then there are not enough points to fill the
  308. sphere.
  309.  
  310. The brute-force algorithm loops through every point in space.  For each point,
  311. the algorithm finds the distance between that point and every other point and
  312. puts that distance into the pri.  When all points have been compared against
  313. this point, the NUMINSPHERE'th element is taken to be the minimum radius of a
  314. sphere centered at this point containing NUMINSPHERE points.  However, points
  315. are not compared against themselves, so the exact number of comparisons is
  316. N^2-N, making this an N^2 algorithm.
  317.  
  318. The efficient algorithm designed by Chris Williams and me divides the space
  319. into a 3-dimensional grid.  If the grid is divided into NUMPOINTS/NUMINSPHERE
  320. sectors, then at least one of the sectors must have at least NUMINSPHERE
  321. points.  Now, make spheres with the same volume as the sectors.  At least one
  322. sphere surrounding one point will have at least NUMINSPHERE points.  It turns
  323. out that the tradeoff between fewer computations and more overhead is
  324. minimized by choosing the grid to have enough sectors such that each sector is
  325. r/2 on each side (where r is the radius of the aforementioned sphere).  Our
  326. algorithm starts with a sphere radius equal to the distance from one corner of
  327. the unit cube to another (3^.5).  Given the first point in the list, we
  328. compare that point against every other point in sectors touching the sphere
  329. (In this case, every other point in space!)  By storing the distances and then
  330. taking the NUMINSPHERE'th number from the pri list, as in the brute algorithm,
  331. we frequently reduce the size of the sphere.  Then, we check the next point
  332. with the new, smaller sphere size and continue in this way until we have
  333. tested every point.  As we go along, the minimum sphere size keeps shrinking
  334. until for any given point, we only check a few neighboring sectors, if any.
  335. In practice, this radius shrinks so quickly that the algorithm displays LINEAR
  336. BEHAVIOR!
  337.  
  338. NOTE:  This program was written for clarity, not for efficiency.  If it is to
  339. be used in any real applications, there are many ways to speed it up.
  340.  
  341.  
  342.                   Bruteforce:                     Our algorithm:
  343.                                                (Average of 3 runs)
  344. Points:   #Comparisons:  comps/points:     #Comparisons:  comps/points:
  345.      50            2450         49.000               958         19.160
  346.      75            5550         74.000              1241         16.547
  347.     100            9900         99.000              2111         21.110
  348.     150           22350        149.000              2785         18.567
  349.     200                                             3689         18.445
  350.     250                                             5120         20.480
  351.     300                                             6010         20.033
  352.     350                                             7149         20.426
  353.     400                                             7658         19.145
  354.     600                                            11404         19.007
  355.     800                                            16781         20.976
  356.    1000                                            20438         20.438
  357.  
  358.  
  359.  
  360. Testing 50 points.
  361. Brute-force:
  362.    Best sphere:    0.3067962678
  363.    Number of comparisons:     2450
  364. Efficient Algorithm:
  365.    Best sphere:    0.3067962678
  366.    Number of comparisons:      946
  367.  
  368.  %time  cumsecs  #call  ms/call  name
  369.   31.6     0.10      1   100.01  _brutecluster      <====
  370.   10.5     0.18      1    33.34  _elegantcluster    <====
  371.    5.3     0.25    101     0.17  _clearprilist
  372.    5.3     0.27    581     0.03  _insertprilist
  373.    5.3     0.28      1    16.67  _makespace
  374.  
  375. Testing 300 points.
  376. Brute-force:
  377.    Best sphere:    0.1569231423
  378.    Number of comparisons:    89700
  379. Efficient Algorithm:
  380.    Best sphere:    0.1569231423
  381.    Number of comparisons:     5617
  382.  
  383.  %time  cumsecs  #call  ms/call  name
  384.   44.2     3.27      1  3267.00  _brutecluster      <====
  385.    2.9     6.82      1   216.69  _elegantcluster    <====
  386.    1.1     7.00   2358     0.04  _insertprilist
  387.    0.2     7.33    601     0.03  _clearprilist
  388.    0.0     7.38      1     0.00  _makespace
  389. }
  390.  
  391. {==========================================================================}
  392.  
  393. program clusters(input,output);
  394.  
  395. const
  396.   MAXNUMPOINTS = 501;    { The maximum # of points we can handle  }
  397.   NUMINSPHERE = 10;      { # stars to find inside sphere          }
  398.   INFINITY = 999999.9;   { Larger than largest distance possible  }
  399.   MAXUSESPACE = 20;      { Maximum length per edge of space-grid  }
  400.   PI = 3.1415926535;
  401.  
  402. type
  403.   datatype = real;
  404.   point = record         { The type of a point }
  405.             x : real;
  406.             y : real;
  407.             z : real;
  408.             data : datatype;
  409.           end;
  410.   ptr = ^node;
  411.   node = record          { Linked list for a distances list called "pri" }
  412.            data : real;
  413.            next : ptr;
  414.          end;
  415.   sptr = ^spacenode;     { Linked list for each sector in the space-grid }
  416.   spacenode = record
  417.                 index : integer; { Stores index of that point in points[] }
  418.                 next : sptr;
  419.               end;
  420.  
  421.  
  422. var
  423.   rndnm : integer;       { Needed for the random number generator }
  424.   points : array [1..MAXNUMPOINTS] of point;   { All points in space }
  425.   listhead : ptr;        { List head for distances list called "pri" }
  426.   space : array[0..MAXUSESPACE, 0..MAXUSESPACE, 0..MAXUSESPACE] of sptr;
  427.                          { The space-grid (hereafter called 'grid') }
  428.   spacesize, usespace : integer;  { Size per edge of grid }
  429.   NUMPOINTS : integer;   { The number of points we have in space }
  430.  
  431.  
  432. { **************** Support routines for random generators ************** }
  433.  
  434. procedure seed;        { Seed the random number generator }
  435. begin
  436.   writeln('seed:');
  437.   readln(rndnm);
  438. end;
  439.  
  440. function rndom(scale : integer) : real; { Make random real from 0 to scale }
  441. begin
  442.   rndnm := abs(abs((rndnm*921+1)) mod 32749);
  443.   rndom := (rndnm*scale/32749)
  444. end;
  445.  
  446. procedure randompoint(var pt : point);  { Generate a random point within }
  447. begin                                   {   a unit cube.                 }
  448.   pt.x := rndom(1);
  449.   pt.y := rndom(1);
  450.   pt.z := rndom(1)
  451. end;
  452.  
  453. procedure generatepoints;           { Generate NUMPOINTS points in space }
  454. var x : integer;
  455. begin
  456.   for x := 1 to NUMPOINTS do
  457.     randompoint(points[x])
  458. end;
  459.  
  460.  
  461. { *************** Support routines for the "pri" list ******************** }
  462.  
  463. procedure initprilist;    { Initialize the pri list }
  464. begin
  465.   new(listhead);
  466.   listhead^.data := 0.0;
  467.   new(listhead^.next);
  468.   listhead^.next^.data := INFINITY;
  469.   listhead^.next^.next := nil
  470. end;
  471.  
  472. procedure clearprilist;   { Clear the pri list }
  473. var p,oldp : ptr;
  474. begin
  475.   p := listhead;
  476.   while p <> nil do
  477.   begin
  478.     oldp := p;
  479.     p := p^.next;
  480.     dispose(oldp)
  481.   end;
  482.   new(listhead);
  483.   listhead^.data := 0.0;
  484.   new(listhead^.next);
  485.   listhead^.next^.data := INFINITY;
  486.   listhead^.next^.next := nil
  487. end;
  488.  
  489.  
  490. procedure insertprilist(r : real);  { Insert a distance into pri list    }
  491. var p,oldp,temp : ptr;       { "pri" is just a linked list of distances  }
  492.     x : integer;             { kept in low -> high order. The catch is   }
  493. begin                        { that if a number should be inserted after }
  494.   x := 1;                    { the NUMINSPHERE'th node, we don't bother  }
  495.   p := listhead^.next;       { inserting it, because it isn't in the     }
  496.   oldp := listhead;          { smallest sphere with NUMINSPHERE points.  }
  497.   while (r > p^.data) and (x <= NUMINSPHERE) do
  498.   begin
  499.     oldp := p;
  500.     p := p^.next;
  501.     x := x + 1
  502.   end;
  503.   if x <= NUMINSPHERE then
  504.   begin
  505.     new(temp);
  506.     temp^.data := r;
  507.     temp^.next := p;
  508.     oldp^.next := temp
  509.   end
  510. end;
  511.  
  512. function getbiggestinsphere : real;  { Returns value of the NUMINSPHERE'th }
  513. var x : integer;                     { element in pri list, or INFINITY    }
  514.     p : ptr;                         { if the list isn't that long.        }
  515. begin
  516.   x := 1;
  517.   p := listhead^.next;
  518.   while (x < NUMINSPHERE) and (p <> nil) do
  519.   begin
  520.     x := x + 1;
  521.     p := p^.next
  522.   end;
  523.   if (x < NUMINSPHERE) or (p = nil) then getbiggestinsphere := INFINITY
  524.   else getbiggestinsphere := p^.data
  525. end;
  526.  
  527. procedure printprilist;              { Print the pri list, for debugging }
  528. var p : ptr;
  529. begin
  530.   p := listhead;  { DO print the head }
  531.   while p <> nil do
  532.   begin
  533.     writeln(p^.data:15:10);
  534.     p := p^.next
  535.   end;
  536.   writeln('nil')
  537. end;
  538.  
  539.  
  540. { ******************* Miscellaneous support routines ******************** }
  541.  
  542. procedure printpoint(pt : point);   { Print out a point }
  543. begin
  544.   writeln('(',pt.x:8:5,',',pt.y:8:5,',',pt.z:8:5,')')
  545. end;
  546.  
  547.  
  548. function cube(x : real) : real;     { Return cube root of a number }
  549. begin
  550.   cube := exp((1/3)*ln(x))
  551. end;
  552.  
  553.  
  554. { *********************** Brute Force algorithm ************************* }
  555.  
  556. procedure brutecluster;    { Find minimum sphere containing NUMINSPHERE }
  557.                            {   points by testing the distance between   }
  558.                            {   every point.                             }
  559. var distx,disty,distz,dist : real;      { Find distance between two points }
  560.     bestsphere,trysphere : real;        { Find minimum sphere              }
  561.     numcomps : integer;                 { # comparisons                    }
  562.     thispoint,againstpoint : integer;   { Counters                         }
  563. begin
  564.   clearprilist;                           { Kill the priority list          }
  565.   bestsphere := INFINITY;
  566.   numcomps := 0;
  567.   for thispoint := 1 to NUMPOINTS do      { Test every point...             }
  568.   begin
  569.     clearprilist;
  570.     for againstpoint := 1 to NUMPOINTS do { ...against every other point    }
  571.       if thispoint <> againstpoint then   { Don't compare point against self}
  572.       begin
  573.         distx := points[thispoint].x - points[againstpoint].x;
  574.         disty := points[thispoint].y - points[againstpoint].y;
  575.         distz := points[thispoint].z - points[againstpoint].z;
  576.         dist := sqrt(distx*distx + disty*disty + distz*distz);
  577.         numcomps := numcomps + 1;
  578.         if dist < bestsphere then       { If dist less than smallest sphere,}
  579.           insertprilist(dist)           {   insert distance into pri list   }
  580.       end;
  581.     trysphere := getbiggestinsphere;   { Get 'NUMINSPHERE'th item from list }
  582.     if trysphere < bestsphere then     { If this radius is the smallest yet,}
  583.       bestsphere := trysphere;         {   then remember it.                }
  584.   end;
  585.   writeln('Brute-force:');
  586.   writeln('   Best sphere: ',bestsphere:15:10);
  587.   writeln('   Number of comparisons: ',numcomps:8)
  588. end;
  589.  
  590.  
  591. { **************************** My algorithm *********************** }
  592.  
  593. procedure makespace;        { Build the space-grid.  See documentation at }
  594. var x,y,z : integer;        { beginning of program for details.           }
  595.     temp : sptr;
  596.     thispoint : integer;
  597. begin
  598.   spacesize := trunc(cube(8*PI*NUMPOINTS/NUMINSPHERE));
  599.   usespace := spacesize-1;
  600.   if usespace > MAXUSESPACE then writeln('****** NOT ENOUGH MEMORY FOR GRID');
  601.   for x := 0 to usespace do
  602.     for y := 0 to usespace do
  603.       for z := 0 to usespace do
  604.         space[x,y,z] := nil;     { Clear the grid }
  605.   for thispoint := 1 to NUMPOINTS do     { Go through every point... }
  606.   begin
  607.     new(temp);
  608.     temp^.index := thispoint;
  609.     x := trunc(points[thispoint].x * spacesize);
  610.     y := trunc(points[thispoint].y * spacesize);
  611.     z := trunc(points[thispoint].z * spacesize);
  612.     temp^.next := space[x,y,z];          { Put this point into proper }
  613.     space[x,y,z] := temp;                {   sector in grid.          }
  614.   end
  615. end;
  616.  
  617.  
  618. procedure elegantcluster;    { Find smallest sphere containing NUMINSPHERE }
  619.                              {   points by looping through every point,    }
  620.                              {   checking ROUGHLY only the points within   }
  621.                              {   a radius less than or equal to the        }
  622.                              {   minimum radius found so far.              }
  623. var bestsphere,trysphere : real;
  624.     xmin,xmax,ymin,ymax,zmin,zmax : integer; { Dimensions of box to check }
  625.     thispoint : integer;              { The current point to test against }
  626.     x,y,z : integer;                  { The current grid we are testing   }
  627.     distx,disty,distz,dist : real;    { For computing distances           }
  628.     numcomps : integer;               { # comparisons                     }
  629.     cpindex : sptr;          { Pointer into point list for a grid sector  }
  630. begin
  631.   makespace;
  632.   bestsphere := 1.732050808;    { Start with radius of distance from one }
  633.   numcomps := 0;                {   corner of unit cube to other: 3^.5   }
  634.   for thispoint := 1 to NUMPOINTS do    { Loop for every point }
  635.   begin
  636.     clearprilist;
  637.     xmin := trunc((points[thispoint].x - bestsphere) * spacesize);
  638.     xmax := trunc((points[thispoint].x + bestsphere) * spacesize);
  639.     ymin := trunc((points[thispoint].y - bestsphere) * spacesize);
  640.     ymax := trunc((points[thispoint].y + bestsphere) * spacesize);
  641.     zmin := trunc((points[thispoint].z - bestsphere) * spacesize);
  642.     zmax := trunc((points[thispoint].z + bestsphere) * spacesize);
  643.     if xmin < 0 then xmin := 0;
  644.     if ymin < 0 then ymin := 0;               { Get dimensions of box      }
  645.     if zmin < 0 then zmin := 0;               { containing every sector in }
  646.     if xmax > usespace then xmax := usespace; { grid that we want to check }
  647.     if ymax > usespace then ymax := usespace; { against the current point  }
  648.     if zmax > usespace then zmax := usespace;
  649.     for x := xmin to xmax do
  650.       for y := ymin to ymax do
  651.         for z := ymin to ymax do   { Loop through every sector in this box }
  652.         begin
  653.           cpindex := space[x,y,z];
  654.           while cpindex <> nil do  { Test against every point in this sector}
  655.           begin
  656.             if thispoint <> cpindex^.index then  { Don't test point against }
  657.             begin                                {   itself.                }
  658.               distx := points[thispoint].x - points[cpindex^.index].x;
  659.               disty := points[thispoint].y - points[cpindex^.index].y;
  660.               distz := points[thispoint].z - points[cpindex^.index].z;
  661.               dist := sqrt(distx*distx + disty*disty + distz*distz);
  662.               numcomps := numcomps + 1;
  663.               if dist < bestsphere then  { If dist less than smallest sphere}
  664.                 insertprilist(dist)      {   insert distance into pri list  }
  665.             end;
  666.             cpindex := cpindex^.next     { Get next point in this sector }
  667.           end
  668.         end;
  669.     trysphere := getbiggestinsphere;
  670.     if trysphere < bestsphere then
  671.       bestsphere := trysphere
  672.   end;
  673.   writeln('Efficient Algorithm:');
  674.   writeln('   Best sphere: ',bestsphere:15:10);
  675.   writeln('   Number of comparisons: ',numcomps:8)
  676. end;
  677.  
  678.  
  679. begin
  680.   seed;
  681.   writeln('How many points?');
  682.   readln(NUMPOINTS);
  683.   if NUMPOINTS < NUMINSPHERE then
  684.     writeln('***** Must have at least ',NUMINSPHERE:1,' points.')
  685.   else
  686.   begin
  687.     writeln('Testing ',NUMPOINTS:1,' points.');
  688.     initprilist;
  689.     generatepoints;
  690.     brutecluster;
  691.     elegantcluster
  692.   end
  693. end.
  694.  
  695. -------------------------------------------------------------------------------
  696.  
  697. Parallelism & Modeler Info Request, by Brian Corrie
  698.      ...!uw-beaver!uvicctr!bcorrie   bcorrie@uvicctr.UVic.ca
  699.  
  700. [soon to be a posting on USENET, but it hadn't reached my node yet.]
  701.  
  702.  
  703. Howdy folks....
  704.  
  705.     It's survey time again, and I would appreciate your participation in this
  706. version of twenty questions.
  707.  
  708. I am interested in parallel algorithms for ray tracing, and I am curious about
  709. a couple of things.  Please note that I have most of the "standard references"
  710. that get cited in the literature, but I am interested in some of the OTHER
  711. stuff that is out there.
  712.  
  713. The papers that I have:
  714.  
  715. Cleary et al.  "Multiprocessor Ray Tracing", Internal Report, 83/128/17,
  716. Department of Computer Science, University of Calgary, Calgary, Alberta,
  717. Canada.
  718.  
  719. Dippe et al "An Adaptive Subdivision Algorithm and Parallel Architecture for
  720. Realistic Image Synthesis", Computer Graphics, Volume 18, Number 3.
  721.  
  722. Gaudet et al "Multiprocessor Experiments for High Speed Ray Tracing", ACM
  723. TOG, Volume 7, Number 3.
  724.  
  725. etc.....
  726.  
  727. What I am interested in are references to some of the goodies that are out
  728. there in the real world.  Are there any papers on the hardware Pixar uses.
  729. How about the AT&T pixel machine, the Connection Machine (there is a piece on
  730. it in Scientific American, Volume 256, Number 6 that I already have), and
  731. other bizarre architectures.  Dave Jevans from the University of Calgary (Hi
  732. Dave, remember me?  I met you at SIGGRAPH this year) mentioned at one point he
  733. implemented some stuff on a BBN Butterfly (I think).  Any more info on that
  734. Dave?  Did you write it up?  Anybody else doing anything similar?
  735.  
  736. Here is the info I want....
  737.  
  738. 1) What architecture do you run on?
  739. 2) Parallel, vectorized etc?
  740.  
  741. For parallel systems:
  742.  
  743. 3) How many processors do you use?
  744. 4) How tightly coupled are they?
  745. 5) Do you perform any load balancing, and if so how?
  746. 6) Architectural requirements (memory/node, communications etc)?
  747. 7) Anything else you can think of that might be useful.
  748.  
  749. Thanks in advance for any help you can give me.  Replies by email are of
  750. course the best route to take, but I read comp.graphics every morning, so a
  751. reply here will be seen.  I will post a summary to the net if I get enough
  752. information.
  753.  
  754. ========
  755.  
  756. Question number two....
  757.  
  758. This should be quick and easy.  I would like to know what kind of modelling
  759. software people use out there in the real world.
  760.  
  761. We have all seen the pretty pictures, but how do they get created?  I would
  762. appreciate a quick or not so quick review of what kind of software is used at
  763. your site to model 3D scenes.
  764.  
  765. For those of you in the RT News mailing list and don't read the net like I do,
  766. I will send a copy of both this and the summary to Eric.
  767.  
  768.     Thanks,
  769.  
  770.     Brian
  771.  
  772. ======== USENET cullings follow ===============================================
  773.  
  774. Ray Tracer Available, by Craig Kolb
  775.     From: craig@weedeater.math.yale.edu
  776.     Newsgroups: comp.graphics
  777.     Organization: Math Department, Yale University
  778.  
  779. All of this talk of solid texturing and the like has convinced me to pull
  780. together my raytracer for public consumption.  Although I'm calling this a
  781. beta release, relatives of this version of rayshade have been making pretty
  782. pictures for about a year now.  For examples, see slides 32 and 57 from the
  783. SIGGRAPH '89 technical slide set and slides 67/68 from the stereo slide set.
  784.  
  785. If there's enough interest, I'll post rayshade to comp.sources.unix once the
  786. bugfixes stop rolling in.
  787.  
  788. [I would like to add that Craig's ray tracer is fairly nice, and most of the
  789. portability problems and minor bugs have been fixed since its release.  Its
  790. input language is much more full featured than NFF (which, I'll say again, was
  791. made only for testing ray tracers, not photorealism) and looks more mainstream
  792. than some of the other public domain ray tracers I've seen.  If you're looking
  793. for a reasonable input language, check his out.  His latest and greatest
  794. version (i.e. newer that 2.21) might be available via ftp by now. - EAH]
  795.  
  796. --
  797.  
  798. Rayshade, a raytracing program, is available for "Beta" testing.  Rayshade
  799. reads a multi-line ASCII file describing a scene to be rendered and produces a
  800. Utah Raster RLE format file of the raytraced image.
  801.  
  802. Features:
  803.  
  804.         Primitives:
  805.                 boxes
  806.                 cones
  807.                 cylinders
  808.                 height fields
  809.                 planes
  810.                 polygons
  811.                 spheres
  812.                 triangles       (flat- or Phong-shaded)
  813.         [he forgot to mention there are also superquadrics! - EAH]
  814.  
  815.         Composite objects
  816.  
  817.         Point, directional, and extended (area) light sources
  818.  
  819.         Solid texturing and bump mapping of primitives, objects, and
  820.                 individual instances of objects
  821.  
  822.         Antialiasing through adaptive supersampling or "jittered" sampling
  823.  
  824.         Arbitrary linear transformations of primitives,
  825.                 instances of objects, and texture/bump maps
  826.  
  827.         Use of uniform spatial subdivision and/or hierarchy of
  828.                 bounding volumes to speed rendering
  829.  
  830.         Options to facilitate rendering of stereo pairs
  831.  
  832.         Support for the Linda parallel programming language
  833.  
  834. An awk script is provided to translate NFF format scripts to rayshade format.
  835.  
  836. Rayshade is written in C with parsing support provided through lex and yacc.
  837. The C, lex and yacc files comprise approximately eight thousand lines of
  838. code.  Sites without lex and yacc can make use of the C source files produced
  839. by lex and yacc which are included in this distribution.
  840.  
  841. Rayshade has been tested on a number of UNIX-based machines, including
  842. Vaxes, Sun Workstations, Iris 4D Workstations, Encore Multimax, AT&T 3B2/310,
  843. Cray XMP, and IBM RTs.  In addition, support is provided for the Amiga using
  844. the Aztec C compiler.
  845.  
  846. Rayshade makes use of the Utah Raster toolkit, a package consisting of a
  847. large number of useful image manipulation programs, test images, and a
  848. library to read and write images written using the toolkit's RLE format.  The
  849. toolkit is available via anonymous FTP from cs.utah.edu or from
  850. weedeater.math.yale.edu.
  851.  
  852. Those sites that cannot or do not want to use the Utah Raster toolkit can
  853. make use of a compile-time option to produce images written using a generic
  854. file format identical to that used in Mark VandeWettering's "MTV" raytracer.
  855.  
  856. This version of rayshade is a "beta" release.  The first "real" release will
  857. include an updated manual page and additional documentation as well as
  858. any bugfixes or extensions born out of this release.
  859.  
  860. Rayshade is copyrighted in a "Gnu-like" manner.
  861.  
  862. Rayshade is available via anonymous ftp from weedeater.math.yale.edu
  863. (192.26.88.42) in pub/Rayshade.2.21.tar.Z.  The Utah Raster toolkit
  864. is available in pub/UtahToolkit.tar.Z.
  865.  
  866. -------------------------------------------------------------------------------
  867.  
  868. Source from Roy Hall's Book, by Tim O'Connor
  869.     From: toc@batcomputer.tn.cornell.edu
  870.     Newsgroups: comp.graphics
  871.  
  872. Straight from the dragon's mouth (so to speak) comes the source from
  873. "Illumination and Color in Computer Generated Imagery" by Roy Hall.  It's now
  874. available via anonymous ftp from:
  875.  
  876.     freedom.graphics.cornell.edu (128.84.247.85)
  877.  
  878. It's under pub/Hall and comes in two files:  1) README (of course) which also
  879. contains some code necessary to convert 2) code.tar.Z.a which contains the
  880. actual code.  So, as always, read README first.
  881.  
  882. Those of you who do not have ftp access may wish to drop me a short line (a
  883. Subject:  of "gimme roy's source" is adequate).  If there's enough interest
  884. I'll post to this group, if not I'll (shudder!)  attempt to mail it right to
  885. you.
  886.  
  887. Also of interest on freedom are the Ray Tracing News archives (under
  888. pub/RTNews) and the Xcu Widget Set.  (Sorry, this code available only in
  889. stores, no mailing.)
  890.  
  891.     fishing in McElligot's Pool,
  892.         to'c
  893.  
  894. -------------------------------------------------------------------------------
  895. I decided to repost the above two notes again, since they are very worthwhile.
  896. For the rest of the USENET cullings, check the archives.
  897.  
  898.  
  899.